package sample.chapter7.usingmaps;

public class Dog
{
	private String name;

	public Dog(String n)
	{
		name = n;
	}

	@Override
	public boolean equals(Object obj)
	{
		if(this==obj) return true;
		if(!(obj instanceof Dog))
		{
			return false;
		}
		Dog dog = (Dog)obj;
		return this.name.equals(dog.name);
	}

	@Override
	public int hashCode()
	{
		return name.length();
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

}
